using System;
using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Uow;
using SanJ.FreeCare.Medications;

namespace SanJ.FreeCare.Medications
{
    public class MedicationsDataSeedContributor : IDataSeedContributor, ISingletonDependency
    {
        private bool IsSeeded = false;
        private readonly IMedicationRepository _medicationRepository;
        private readonly IUnitOfWorkManager _unitOfWorkManager;

        public MedicationsDataSeedContributor(IMedicationRepository medicationRepository, IUnitOfWorkManager unitOfWorkManager)
        {
            _medicationRepository = medicationRepository;
            _unitOfWorkManager = unitOfWorkManager;

        }

        public async Task SeedAsync(DataSeedContext context)
        {
            if (IsSeeded)
            {
                return;
            }

            await _medicationRepository.InsertAsync(new Medication
            (
                id: Guid.Parse("7f5f4452-c517-450a-b906-bc17bc60ec26"),
                code: "bf7ff320151b426182fa94c1dd7e82b84ac0ec65cbf34416adef25351c04785d45c05583244d4c",
                statusCode: "2767f39cc674495d92c64d631fc3ce4471fd497bd47e4b8bbf76ca3a515",
                keyWord: "89286074",
                productName: "c55c9798d9fa472dab28866ccf9ef50a25747e2349fd44b89688966e",
                productNamePY: "652fa57088f6496882c7321b1a869256a965721c0fd74a5db978b7dd4c592cea0159bbefad934b4395675",
                productNameWB: "195b1751129847ae9a0bebc8be0954f65d044b15292643778d6dd572ae449480a802ec",
                productNameEN: "691fbed1d7834f888b531692c2ae14c940e0df93d5324651aa539e1e585f837f7a6cdf381ef546469da8b0",
                alias: "bb928cc63c184a28b4c7e40c9b0cf9109bb5",
                aliasPY: "17f9db27b12046c38a846baf268f1ea006281",
                aliasWB: "6e9af771b5de4f1da0a60b58cb0cc095eb5286362fe34",
                aliasEN: "581884a03fc84a0ea1b",
                scientificName: "20c84f50f1e849dbaed08a0",
                scientificNamePY: "4fd410b65ce241a8924148632985ab39a6e9929fe83048308c6703c79182caece463949861cf4bdda5921",
                scientificNameWB: "eced2525b53b43f196f3dd8e9a9a45ab5405e827e7474496960aa278d98d48ecdb5196d988214038b9381a5f",
                scientificNameEN: "6d14a33eb20c45a8a5f80ee93c6e0032f366a8e1e136488aaa5491a864b530b07f0523f0085f436",
                antiLevelCode: "89a0f8ff956f49eba3320aa6a89274c80d3418fe080846b6be9b65815a43ecb",
                antiClassCode1: "48d7af5bb1f749da9f855fc387cb0b0927f31d1879d64c659aa97b166e87a9190d89247",
                antiClassCode2: "8f8e97a2950e44eba9b9125dbb3eff7a5c6a67fda60a4000addd15",
                anitDDDUnitCode: "992eefcd87d348289b5859ae96dc0f",
                anitDDDValue: 995793906,
                antiOnceMinValue: 1201963233,
                antiOnceMaxValue: 2037073512,
                antiOnceUnitCode: "3685a8f11a614c17a1d914222f296137bb84b39849a9489da110cfea101d07050695aed2",
                antiFrequencyMin: 558308301,
                antiFrequencyMax: 1577264626,
                gBCode: "5851e6addf954bbcb8423f2edd33f06c5c3d3da3dbf74daa82f9d34734282570885e17c44d5f4aaeb42",
                typeCode: "d60dd6c166f4412e8e2faf352b86b817a6bc1c40e30c4b5585abe0f4a272c04cc1e06ea93c9c4068beb637",
                classCode: "1d96c13484234f178727e2d2494ddbe3a9d4e6b22de",
                feeTypeCode: "eb02ff3811764abb91088fa953e737f4a3cb6297ae7249f49e4b0ffc6537b6e4dbebdcb0a9fa487ca5d2f3f8c5770d13",
                specialTypeCode: "28cd54df059d48f7b897e19f3a9b9a661e",
                levelCode: "606319",
                doseFormCode: "c1a50767631c45b393ab1192787e414d270257b56c7b4dc6a3ff1af56f58fb969d2657b6443c4bb2af483507fe7ac0",
                specification: "e4536f422b1f419",
                baseUnitCode: "9073325eaffd4fe1840938a792c3152026a8713134374a47b2469425a19c1686d9b114c1",
                clinicSaleUnitCode: "96d9455521014f3bbd8ee8e58b51314a260f1894617b",
                clinicSaleVolume: 2140109159,
                inpatientSaleUnitCode: "8458f02fc67d4415bba75e51e41747ef7539217b9c5f4d508d2",
                inpatientSaleVolume: "d5b05480a6794eb98018770c1348d4f95",
                transportUnitCode: "b8a7238a58e140c288e9ffeebc61ac5",
                transportVolume: "ca187097e42c42b1ba87aa67496",
                defaultDoseUnitCode: "4664f8e25322429fadd65e274e04db195d1bdf4db9aa40c892fe000c4bf77c8f5a6",
                defultDoseVolume: 2146190948,
                secondDoseUnitCode: "f3b2a041d8ab46eca4224ca7ed39c4626cc2f438c5d24bcebabe69d42aeb20dd346aa7f1e1",
                secondDoseVolume: 1108305600,
                retailPrice: 446416336,
                defaultUsageCode: "763fd869cc0949f4b076f95c116285654d73cd8782",
                defaultFrequencyCode: "ad337ad27d93",
                defaultDoseVolume: 474433606,
                skinTestFlag: "a9ddd4e8e",
                skinTestNeedFlag: "44dd5c32d9554e2",
                skinTestTypeFlag: "7cbdd33079864523bcda32b00c1a60c55dae8398c91a44b2a88dde0e50244f0c5b1d4e9dd667421985ef",
                skinTestCode: "d979c94e818043edb66b7b0f13f1224ccf627e75c5894e46957e35a965f96c0cdfee64072"
            ));

            await _medicationRepository.InsertAsync(new Medication
            (
                id: Guid.Parse("5f928844-2c38-44a1-9bc4-117d181edadc"),
                code: "33beb8fb4a2247d181f5eab4d9de206b26771a540b994009b0eb9a199bf7c0cdadadfae93ce740cbb5705ec63d26006",
                statusCode: "e25e2c57614f48b9a42b0f05687deee5fba50c90cff444b0a53869",
                keyWord: "7413f2d8d5ef4506b9fe46139226378a42cc8b9f96a246e0bce855774f339e85e51a",
                productName: "ba719fdccbc8403ab4b30",
                productNamePY: "b3a0f624cf414094adc345ffbb1f31ad2e6f32f016f4454684b1a6ad55cd546edb3097101c1346d9957eee97b5",
                productNameWB: "08694f00d5424147abb2c3fef0d7575d05727e55093940189e5571",
                productNameEN: "5ca0875c06d744c3b8a3fe4f58d0419670d86559c4304176a9fd0b622d18358b3d8478fb4ed84457aab41255",
                alias: "96a62e2d14a648b59937bb7e858cacf7f797b9ce9aa54f119063b8a",
                aliasPY: "4d5a381f405e426e8db2a0b7b01525c39666c74b939f47528302e0ff4f6b0f6b53f479ce373948e1bd50dd3",
                aliasWB: "674f8aea1912407cbd182b6b7",
                aliasEN: "f874384f56b9405fbddfd5ec1e0d1ebd26c4975ab3754870a92615f925762a25560fa6ea9fb44ba29435bb54a3ee21a924",
                scientificName: "81a9e20250e241609e1bf10ee1b371145b1ce101419948b9b686b52f28eaea8acf12cf2d9c2f4c8b863ff50b361a3030f81",
                scientificNamePY: "8a0b3cb565964b2b8abf4aaf1d1e70b2909fb46310c04e98b0505eda1ef00411e0785",
                scientificNameWB: "94becb784a76",
                scientificNameEN: "f5e7ce6259ce45cbb1a9efcdba63252b3b821fa4847a48428e6616a51f0237b74e447e96a56",
                antiLevelCode: "288517ef43ec4855901260caa0c37b71b51b418e85f344",
                antiClassCode1: "67593394b31f4e45a97174ad60ceaa08409131aad3b3",
                antiClassCode2: "0be9c85af94e4df99b8255abdf8c87ce5f4a83cceacb4eb688",
                anitDDDUnitCode: "5cd6d44d52a843b0a9a274b40a2db6fa9e85c6e63ed845bdae10fcfd42",
                anitDDDValue: 425322709,
                antiOnceMinValue: 154082043,
                antiOnceMaxValue: 9831942,
                antiOnceUnitCode: "4a49de1196784f92",
                antiFrequencyMin: 1975066226,
                antiFrequencyMax: 94430605,
                gBCode: "43208f85216a474180975b6ec22568dfad70d76f6",
                typeCode: "9b7cae00aac1477f862861c96bef118d3",
                classCode: "926b924308054590b7927",
                feeTypeCode: "a87d79816c9b44e5ba643276dddc90a824fd4e60b569472b98b7f16e3c",
                specialTypeCode: "0e8f5ef822a24aaeab31",
                levelCode: "600957d836594ee1820b7f03b62af0de031692ea66954cbe9eb203f226ae847",
                doseFormCode: "e40eecbdc0b948209c78bfb1d3316f6c0e996fcc99cd4deba671d7799f06a19dd4bb1f1750d94052ae00d8c42fe6a44844e",
                specification: "6f0a62d0ae834582acc7aef896c22a368274ff0156c649a589a7f624e539b9d63d4994b2d",
                baseUnitCode: "d3f7dcda8fc744ed9bb64e52a8690c3ff2b0d76521",
                clinicSaleUnitCode: "bf1da74c811e4329bae154573b8bb313ed7d59eea2cc4b229273943c27de",
                clinicSaleVolume: 1412426514,
                inpatientSaleUnitCode: "ff792f2e61cc4e25b6241739f135b746151082ec",
                inpatientSaleVolume: "05ed858dc280413d8c590d8ca62efe0b5d7fd2dd560647c88948fd32e3399b43f4b7047b",
                transportUnitCode: "d467621107f04621b1060e1f857e2433bfa7002220464767964261b1c6d559718a50322",
                transportVolume: "79ce0960e81c4aba9ec3ed6f",
                defaultDoseUnitCode: "2fc23e6c76cb47cc8c1d1ebd6ed3602dc9ee52f1cd6e45b9a67a3b28e2c66b0b401d8c0136a944c1ba2",
                defultDoseVolume: 2129115615,
                secondDoseUnitCode: "5c01ff6dc28d44159800b78d7878e408b07e",
                secondDoseVolume: 75600657,
                retailPrice: 1115306715,
                defaultUsageCode: "4283a197c118449c81f1909089d5e4e0fc4c6977b0cf43f297ac34fe135947f618be0a7723ac425780f",
                defaultFrequencyCode: "e3c998707f3c4ac0bbee007a16dd68add02cf94feec640f1bffd85d63141781db56ef",
                defaultDoseVolume: 2141397899,
                skinTestFlag: "f28ae0270fe0411e857f01e4e66d",
                skinTestNeedFlag: "2d78f5ce3bc74a13920162fa767d416f33730c9474ad4f52b9a45aa4c3",
                skinTestTypeFlag: "df6da51466c54c7b961e619567778bd9f25b9f0c69af4d29847d8a46473ed0eb530e7f",
                skinTestCode: "eb10e4b0c2a8476c861fc894f0b6782d468f2af408c5419faf543b1facf73d701ab18e0855894497b5b89afc2"
            ));

            await _unitOfWorkManager!.Current!.SaveChangesAsync();

            IsSeeded = true;
        }
    }
}